home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Draw / Sources / ToolFrm.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  3.4 KB  |  109 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                ToolFrm.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //
  8. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef TOOLFRM_H
  13. #define TOOLFRM_H
  14.  
  15. #ifndef UTILS_H
  16. #include "Utils.h"
  17. #endif
  18.  
  19. #ifndef FLOATFRM_H
  20. #include "FloatFrm.h"
  21. #endif
  22.  
  23. #ifndef FWRECEVR_H
  24. #include "FWRecevr.h"
  25. #endif
  26.  
  27. //========================================================================================
  28. // Constants
  29. //========================================================================================
  30.  
  31. const unsigned short kToolCellSize = 21;
  32.  
  33. const unsigned short kToolWidth = 1 + kToolCellSize + 1 + kToolCellSize + 1;
  34. const unsigned short kToolHeight = 1 + kToolCellSize + 1 + kToolCellSize + 1 + kToolCellSize + 1;
  35.  
  36. const unsigned short kSelectorHeight = 12;
  37. const short kFillFrameSelectorPos = 2 + kToolHeight + 2;
  38.  
  39. const unsigned short kColorSelectorWidth = kToolWidth - 4;
  40. const unsigned short kColorSelectorHeight = 30;
  41.  
  42. const unsigned short kToolsWindowWidth = 2 + kToolWidth + 2;
  43. const unsigned short kToolsWindowHeight = 2 + kToolHeight + 2 + kSelectorHeight + 2 + 2 + 4 + kColorSelectorHeight + 4;
  44.  
  45. //========================================================================================
  46. // Forward Declaration
  47. //========================================================================================
  48.  
  49. class FW_CMouseEvent;
  50. class FW_CGraphicContext;
  51.  
  52. class CDrawPart;
  53.  
  54. //========================================================================================
  55. // CToolFrame
  56. //========================================================================================
  57.  
  58. class CToolFrame : public CFloatingWindowFrame, public FW_MReceiver
  59. {
  60. //----------------------------------------------------------------------------------------
  61. // Initialization/destruction
  62. //
  63. public:        
  64.  
  65.     FW_DECLARE_AUTO(CToolFrame)
  66.     
  67.     CToolFrame(Environment *ev, ODFrame* odFrame, FW_CPresentation* presentation, CDrawPart* drawPart);
  68.     virtual ~ CToolFrame();
  69.  
  70. //----------------------------------------------------------------------------------------
  71. // Inherited
  72. //
  73. public:    
  74.     virtual void                 Draw(Environment *ev, ODFacet* odFacet, ODShape* invalidShape);
  75.     virtual FW_Handled            DoMouseDown(Environment *ev, const FW_CMouseEvent& theMouseEvent);
  76.     
  77.     virtual void                HandleNotification(Environment* ev, const FW_CNotification& notification);
  78.  
  79. //----------------------------------------------------------------------------------------
  80. // New API
  81. //
  82. public:
  83.     void                    CheckTool(Environment *ev, 
  84.                                         unsigned short oldTool, 
  85.                                           unsigned short newTool);
  86.     void                    CheckRenderVerb(Environment *ev, 
  87.                                             unsigned short oldRenderVerb, 
  88.                                                  unsigned short newRenderVerb);
  89.     
  90. private:
  91.     void                    InvertTool(FW_CGraphicContext& gc, unsigned short theTool, FW_Boolean state);
  92.     void                    DrawRenderVerb(FW_CGraphicContext& gc, 
  93.                                             unsigned short renderVerb, 
  94.                                             const FW_CColor& color);
  95.     void                    DrawTools(FW_CGraphicContext& gc);
  96.     void                    DrawColors(FW_CGraphicContext& gc);
  97.     
  98.     
  99. //----------------------------------------------------------------------------------------
  100. // Data Members
  101. //
  102. private:    
  103.     CGrid                    fToolGrid;
  104.     CGrid                    fFillFrameGrid;
  105.     CDrawPart*                fDrawPart;
  106. };
  107.  
  108. #endif
  109.